﻿<Window x:Class="Smith.WPF.HtmlEditor.TableDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Smith.WPF.HtmlEditor"
		xmlns:recs="clr-namespace:Smith.WPF.HtmlEditor.Resources"
        WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False"
        Title="{x:Static recs:UiText.WinTitle_InsertTable}" Height="240" Width="400" Icon="/Smith.WPF.HtmlEditor;Component/Resources/Images/table.png">
	<Window.Resources>
		<Style TargetType="{x:Type Label}">
			<Setter Property="HorizontalContentAlignment" Value="Right" />
			<Setter Property="VerticalContentAlignment" Value="Center" />
		</Style>
		<Style TargetType="{x:Type TextBox}">
			<Setter Property="Margin" Value="4" />
		</Style>
		<Style x:Key="NumericInput" TargetType="{x:Type TextBox}">
			<Setter Property="Margin" Value="4" />
			<Setter Property="local:PositiveIntegerInput.Enable" Value="True" />
		</Style>
		<Style TargetType="{x:Type ComboBox}">
			<Setter Property="Margin" Value="4" />
			<Setter Property="DisplayMemberPath" Value="Text" />
		</Style>
		<Style x:Key="UnitOptionSelection" TargetType="{x:Type ComboBox}">
			<Setter Property="Margin" Value="1,5,5,5" />
			<Setter Property="Width" Value="40" />
			<Setter Property="DisplayMemberPath" Value="Text" />
			<Setter Property="DockPanel.Dock" Value="Right" />
		</Style>
	</Window.Resources>
    <Grid Background="#FFEFEFEF">
        <DockPanel>
            <Border DockPanel.Dock="Bottom" Padding="12">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button x:Name="OkayButton" Content="{x:Static recs:UiText.Button_OK}" Width="56"  Margin="8,0"  />
                    <Button x:Name="CancelButton" Content="{x:Static recs:UiText.Button_Cancel}" Width="56" />
                </StackPanel>
            </Border>
            <Border Padding="8">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
						<ColumnDefinition Width="10" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Label Content="{x:Static recs:UiText.Label_RowCount}" Grid.Column="0" Grid.Row="0" />
                    <Label Content="{x:Static recs:UiText.Label_ColCount}" Grid.Column="3" Grid.Row="0" />
                    <Label Content="{x:Static recs:UiText.Label_TableWidth}" Grid.Column="0" Grid.Row="1" />
                    <Label Content="{x:Static recs:UiText.Label_TableHeight}" Grid.Column="3" Grid.Row="1" />
                    <Label Content="{x:Static recs:UiText.Label_Spacing}" Grid.Column="0" Grid.Row="2" />
                    <Label Content="{x:Static recs:UiText.Label_Padding}" Grid.Column="3" Grid.Row="2" />
					<Label Content="{x:Static recs:UiText.Label_TableBorder}" Grid.Column="0" Grid.Row="3" />
					<Label Content="{x:Static recs:UiText.Label_TableTitle}" Grid.Column="3" Grid.Row="3" />
					<Label Content="{x:Static recs:UiText.Label_TableHeader}" Grid.Column="0" Grid.Row="4" />
                    <Label Content="{x:Static recs:UiText.Label_TableAlignment}" Grid.Column="3" Grid.Row="4" />
                    <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=Rows, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NumericInput}" />
                    <TextBox Grid.Column="4" Grid.Row="0" Text="{Binding Path=Columns, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NumericInput}" />
					
					<DockPanel Grid.Column="1" Grid.Row="1">
						<ComboBox x:Name="WidthUnitSelection" SelectedItem="{Binding Path=WidthUnit, Mode=TwoWay}" Style="{StaticResource UnitOptionSelection}" />
						<TextBox Text="{Binding Path=Width, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NumericInput}" />
					</DockPanel>
					
					<DockPanel Grid.Column="4" Grid.Row="1">
						<ComboBox x:Name="HeightUnitSelection" SelectedItem="{Binding Path=HeightUnit, Mode=TwoWay}" Style="{StaticResource UnitOptionSelection}" />
						<TextBox Text="{Binding Path=Height, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NumericInput}" />
					</DockPanel>
					
					<DockPanel Grid.Column="1" Grid.Row="2">
						<ComboBox x:Name="SpaceUnitSelection" SelectedItem="{Binding Path=SpacingUnit, Mode=TwoWay}" Style="{StaticResource UnitOptionSelection}" />
						<TextBox Text="{Binding Path=Spacing, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NumericInput}" />
					</DockPanel>
					
					<DockPanel Grid.Column="4" Grid.Row="2">
						<ComboBox x:Name="PaddingUnitSelection" SelectedItem="{Binding Path=PaddingUnit, Mode=TwoWay}" Style="{StaticResource UnitOptionSelection}" />
						<TextBox Text="{Binding Path=Padding, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NumericInput}" />
					</DockPanel>
                    
					<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Path=Border, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource NumericInput}" />
                    <TextBox Grid.Column="4" Grid.Row="3" Text="{Binding Path=Title, Mode=TwoWay}" />
					<ComboBox x:Name="HeaderSelection" Grid.Column="1" Grid.Row="4" SelectedItem="{Binding Path=HeaderOption, Mode=TwoWay}" />
					<ComboBox x:Name="AlignmentSelection" Grid.Column="4" Grid.Row="4" SelectedItem="{Binding Path=Alignment, Mode=TwoWay}" />
                </Grid>                
            </Border>
        </DockPanel>
    </Grid>
</Window>
